import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_ncsjqz_getx/widget/app_bar_widget.dart';
import 'package:flutter_ncsjqz_getx/widget/gradient_button.dart';
import 'package:flutter_ncsjqz_getx/widget/ink_widget.dart';
import 'package:flutter_ncsjqz_getx/widget/input_widget.dart';
import 'package:get/get.dart';

import 'get_password_logic.dart';

/// <summary>
/// author：zwb
/// dateTime： 2022/1/4 16:05
/// filePath： lib/page/login/get_password_view.dart
/// desc:忘记密码
/// <summary>
///
class GetPasswordPage extends StatefulWidget {
  @override
  _GetPasswordPageState createState() => _GetPasswordPageState();
}

class _GetPasswordPageState extends State<GetPasswordPage> {
  final logic = Get.put(GetPasswordLogic());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: appBarWidget(title: "找回密码"),
      body: Padding(
        padding: EdgeInsets.all(15,),
        child: GetBuilder<GetPasswordLogic>(
          builder: (controller) {
            return Column(
              children: [
                textFieldWidget(
                  hintText: "请输入您的手机号",
                  inputFormatters: [
                    FilteringTextInputFormatter.digitsOnly,
                  ],
                  keyboardType: TextInputType.phone,
                  maxLength: 11,
                  controller: logic.textEditingControllerTel,
                  prefixIcon: InkWidget.imgAsset("my_select.png",padding: EdgeInsets.all(10),),
                  circular: 5,
                  height: 40,
                ),
                SizedBox(height: 20,),
                textFieldWidget(
                  hintText: "请输入验证码",
                  controller: logic.textEditingControllerCode,
                  inputFormatters: [
                    FilteringTextInputFormatter.digitsOnly,
                  ],
                  keyboardType: TextInputType.number,
                  suffixIcon: gradientButton(logic.getTimeDown!=60 ?"${logic.getTimeDown}" :"发送验证码",onTap:logic.getTimeDown!=60 ?null: (){
                    logic.sendAuthCode();
                  }),
                  maxLines: 1,
                  circular: 5,
                  height: 40,
                ),
                SizedBox(height: 40,),
                SizedBox(
                  width: Get.width * 0.6,
                  child: gradientButton("下一步",circular: 40,onTap: (){
                    if(logic.textEditingControllerCode.text!=""){

                    }
                  }),
                )
              ],
            );
          },
        )
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<GetPasswordLogic>();
    super.dispose();
  }
}